<!-- <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

<link  rel="stylesheet" href="__static__/pinglun/css/main.css" />
<link rel="stylesheet" type="text/css" href="__static__/pinglun/css/sinaFaceAndEffec.css" />

<script type="text/javascript" src="__static__/pinglun/js/jquery-1.8.3.min.js"></script>

<title>jQuery多说QQ表情留言评论框代码</title>
</head>
<body> -->
<div id="content" style="width: 700px; height: auto;margin-left:10px;margin-top:40px">
	<div class="wrap">
		<div class="comment">
			<div class="head-face">
				<img src="__static__/pinglun/images/1.jpg" />
				<p>文明留言</p>
			</div>
			<div class="content">
				<div class="cont-box">
					<textarea class="text" id="mess" name="mess" placeholder="请输入..."></textarea>
				</div>
				<div class="tools-box">
					<div class="operator-box-btn"><span class="face-icon">☺</span><span class="img-icon">▧</span></div>
					<div class="submit-btn"><input type="submit" onclick="ti({$Request.session.userid})" value="提交评论" /></div>
				</div>
			</div>
		</div>
		<div id="info-show">
			<ul>
				{volist name="mess" id="mess"}
				<li>
					<div class="head-face">
						<img src="__static__/pinglun/images/1.jpg" / >
					</div>
					<div class="reply-cont">
						<p class="username">{$mess.name}</p>
						<p class="comment-body">{$mess.content}</p>
						<p class="comment-footer">{$mess.create_time}　回复　点赞54　
							{if condition="$mess.user_id eq $Request.session.userid"}
							<button onclick="del({$mess.id})" style="border: none;background-color: transparent;outline: none;">删除</button>
<!--							<a href="{:url('admin/messages/del', array('id' => $mess.id))}">删除</a>-->
							{else /}
							{/if}
						</p>
					</div>
				</li>
				{/volist}
			</ul>
		</div>
	</div>
</div>

<script type="text/javascript" src="__static__/pinglun/js/main.js"></script>
<script type="text/javascript" src="__static__/pinglun/js/sinaFaceAndEffec.js"></script>
<script type="text/javascript">
		function ti(uid) {
			// layer.msg('1');
			var id = uid;
			var mess = $("#mess").val();
			var artresid = {$artres.id};
			$.ajax({
				type: 'post',
				url: "{:url('index/messages/add')}",
				data: { id: id, content: mess, artresid: artresid },
				dataType: 'json',
				success: function (res) {
					if (res.code == 1) {
						layer.msg(res.msg, { icon: 1, time: 1000 });
						setTimeout(function () {
							window.location.reload()
						}, 1000)
					} else if(res.code = 2){
						layer.msg(res.msg , { icon: 5, time: 1000 });
						setTimeout(function () {
							window.location.href="{:url('index/admin/login')}";
						}, 1000)
					}

				},
				error: function (res) {
					console.log(res.msg);
				},
			});
		}
		
		function del(id) {
			// var id = uid;
			$.ajax({
				type: 'post',
				url: "{:url('index/messages/del')}",
				data: { id: id},
				dataType: 'json',
				success: function (res) {
					if (res.code == 1) {
						layer.msg(res.msg, { icon: 1, time: 1000 });
						setTimeout(function () {
							window.location.reload()
						}, 1000)
					} else if(res.code = 2){
						layer.msg(res.msg , { icon: 5, time: 1000 });
						setTimeout(function () {
							window.location.href="{:url('index/admin/login')}";
						}, 1000)
					}

				},
				error: function (res) {
					console.log(res.msg);
				},
			});
		}
</script>
<!-- <script type="text/javascript">
	// 绑定表情
	$('.face-icon').SinaEmotion($('.text'));
	// 测试本地解析
	function out() {
		var inputText = $('.text').val();
		$('#info-show ul').append(reply(AnalyticEmotion(inputText)));
	}
	
	var html;
	function reply(content){
		html  = '<li>';
		html += '<div class="head-face">';
		html += '<img src="__static__/pinglun/images/1.jpg" / >';
		html += '</div>';
		html += '<div class="reply-cont">';
		html += '<p class="username">小小红色飞机</p>';
		html += '<p class="comment-body">'+content+'</p>';
		html += '<p class="comment-footer">2016年10月5日　回复　点赞54　转发12</p>';
		html += '</div>';
		html += '</li>';
		return html;
	}
</script> -->
<!-- </body>
</html> -->